package com.twitch.financialAnalysis.business.controller;

import com.twitch.financialAnalysis.business.pojo.dto.ConstructionInvestDTO;
import com.twitch.financialAnalysis.business.pojo.po.BaseAmortization;
import com.twitch.financialAnalysis.business.pojo.po.BaseDepreciation;
import com.twitch.financialAnalysis.business.pojo.po.BaseFinancing;
import com.twitch.financialAnalysis.business.pojo.po.BaseLiquidity;
import com.twitch.financialAnalysis.business.pojo.vo.*;
import com.twitch.financialAnalysis.business.service.SupportService;
import com.twitch.financialAnalysis.system.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: twitch
 * @Date: 2021/4/7
 * @description: supportTable
 */
@Api("辅助报表")
@RestController
@RequestMapping("/support")
public class SupportController {

    @Autowired
    private SupportService supportService;

    @PostMapping("construction/save")
    @ApiOperation("保存项目建设投资估算表")
    public ResultData<Integer> saveConstructionInvest(@RequestBody ConstructionInvestVO constructionInvestVO) {
        return new ResultData<>(0, "保存成功", supportService.saveConstructionInvest(constructionInvestVO));
    }

    @PostMapping("construction/get")
    @ApiOperation("获取项目建设投资估算表")
    public ResultData<ConstructionInvestDTO> getConstructionInvest(BaseSearchVO searchVO) {
        return new ResultData<>(0, "保存成功", supportService.getConstructionInvest(searchVO));
    }

    @PostMapping("liquidity/save")
    @ApiOperation("保存流动资金估算表")
    public ResultData<Integer> saveLiquidity(@RequestBody LiquidityVO liquidityVO) {
        return new ResultData<>(0, "保存成功", supportService.saveLiquidity(liquidityVO));
    }

    @PostMapping("liquidity/get")
    @ApiOperation("获取流动资金估算表")
    public ResultData<List<BaseLiquidity>> getLiquidity(@RequestBody BaseSearchVO baseSearchVO) {
        return new ResultData<>(0, "保存成功", supportService.getLiquidity(baseSearchVO));
    }

    @PostMapping("financing/save")
    @ApiOperation("保存资金使用计划与资金筹措表")
    public ResultData<Integer> saveFinancing(@RequestBody FinancingVO financingVO) {
        return new ResultData<>(0, "保存成功", supportService.saveFinancing(financingVO));
    }

    @PostMapping("financing/get")
    @ApiOperation("获取资金使用计划与资金筹措表")
    public ResultData<List<BaseFinancing>> getFinancing(@RequestBody BaseSearchVO baseSearchVO) {
        return new ResultData<>(0, "保存成功", supportService.getFinancing(baseSearchVO));
    }

    @PostMapping("depreciation/save")
    @ApiOperation("保存固定资产折旧估算表")
    public ResultData<Integer> saveDepreciation(@RequestBody DepreciationVO depreciationVO) {
        return new ResultData<>(0, "保存成功", supportService.saveDepreciation(depreciationVO));
    }

    @PostMapping("depreciation/get")
    @ApiOperation("获取固定资产折旧估算表")
    public ResultData<List<BaseDepreciation>> getDepreciation(@RequestBody BaseSearchVO baseSearchVO) {
        return new ResultData<>(0, "保存成功", supportService.getDepreciation(baseSearchVO));
    }

    @PostMapping("amortization/save")
    @ApiOperation("保存固定资产折旧估算表")
    public ResultData<Integer> saveAmortization(@RequestBody AmortizationVO amortizationVO) {
        return new ResultData<>(0, "保存成功", supportService.saveAmortization(amortizationVO));
    }

    @PostMapping("amortization/get")
    @ApiOperation("获取固定资产折旧估算表")
    public ResultData<List<BaseAmortization>> getAmortization(@RequestBody BaseSearchVO baseSearchVO) {
        return new ResultData<>(0, "保存成功", supportService.getAmortization(baseSearchVO));
    }



}
